{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-08-18T10:03:48.392266Z",
     "start_time": "2025-08-18T10:03:38.358606Z"
    }
   },
   "source": [
    "from langchain_openai import ChatOpenAI\n",
    "import os\n",
    "chatLLM = ChatOpenAI(\n",
    "    # 若没有配置环境变量，请用百炼API Key将下行替换为：api_key=\"sk-xxx\",\n",
    "    api_key=os.getenv(\"DASH_SCOPE_API_KEY\"), # 如何获取API Key：https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key\n",
    "    base_url=\"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n",
    "    model=\"qwen-plus\"\n",
    ")\n",
    "\n",
    "messages = [\n",
    "    {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
    "    {\"role\": \"user\", \"content\": \"请给我的花店起个名\"}]\n",
    "\n",
    "\n",
    "response = chatLLM.invoke(messages)\n",
    "print(response.content)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当然可以！为了帮你起一个合适的花店名字，我需要了解一些信息：\n",
      "\n",
      "1. **你的花店风格是什么样的**？（例如：浪漫温馨、简约清新、复古文艺、高端大气）\n",
      "2. **主要售卖什么类型的花**？（例如：鲜花、干花、永生花、多肉植物、花艺定制）\n",
      "3. **目标客户群体是谁**？（例如：年轻人、情侣、商务人士、婚礼客户）\n",
      "4. **你希望名字传达什么感觉或寓意**？（例如：幸福、爱情、自然、治愈、优雅）\n",
      "\n",
      "如果你暂时不确定这些，我可以先提供一些不同风格的名字供你参考：\n",
      "\n",
      "### 🌸 温馨浪漫风\n",
      "- 花点时间遇见你  \n",
      "- 与花有约  \n",
      "- 花语心愿  \n",
      "- 爱上一朵花  \n",
      "- 花漾时光\n",
      "\n",
      "### 🌿 自然清新风\n",
      "- 一束阳光花店  \n",
      "- 森系花语  \n",
      "- 花间小径  \n",
      "- 春日花开  \n",
      "- 花田小筑\n",
      "\n",
      "### 💕 文艺小资风\n",
      "- 花信笺  \n",
      "- 花事未央  \n",
      "- 花影留香  \n",
      "- 朝花夕拾  \n",
      "- 花间集\n",
      "\n",
      "### 🎀 高端优雅风\n",
      "- 花悦坊  \n",
      "- 花艺殿堂  \n",
      "- 雅致花舍  \n",
      "- 花之物语  \n",
      "- 琉璃花阁\n",
      "\n",
      "### 💐 活泼可爱风\n",
      "- 花花世界  \n",
      "- 小花的日常  \n",
      "- 花朵朵  \n",
      "- 花果山小铺  \n",
      "- 花开不打烊\n",
      "\n",
      "如果你愿意告诉我更多关于你的花店特色，我可以为你量身定制几个名字哦！🌸\n"
     ]
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "de0081150db97bff"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
